﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vds2465Telegrams;

namespace Vds2465Parser
{
	[TestClass]
	public class GenParse_Checksum_Test
	{
		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test01()
		{
			{
				byte[] dataBytes = new byte[0];
				byte checksumByte = GenParse_Checksum.CalculateChecksum(dataBytes);
				Assert.AreEqual(0x00, checksumByte);
			}

			{
				byte byteValue = 0x56;
				byte[] dataBytes = new byte[1];
				dataBytes[0] = byteValue;
				byte checksumByte = GenParse_Checksum.CalculateChecksum(dataBytes);
				Assert.AreEqual(byteValue, checksumByte);
			}

			{
				byte[] dataBytes = new byte[] { 0x01, 0x02 };
				byte checksumByte = GenParse_Checksum.CalculateChecksum(dataBytes);
				Assert.AreEqual(0x03, checksumByte);
			}

			{
				byte[] dataBytes = new byte[] { 0x01, 0x02, 0xff };
				byte checksumByte = GenParse_Checksum.CalculateChecksum(dataBytes);
				Assert.AreEqual(0x02, checksumByte);
			}
		}
	}
}
